#ifndef CAMERA_H
#define CAMERA_H

#include <SDL.h>
#include "AbstractEntity.h"
#include "Controller.h"
#include "Shape.h"
#include "RenderVisitor.h"

class Game;
class Entity;

/** Renders the scene in a viewport
 *
 * renders a scene in a viewport of given size
 */
class Camera {
	private: // fields
		Game* m_game;
		SDL_Surface* m_screen;
		Position m_cameraPos;
		Vector m_cameraAngle;
		CameraMovementMap m_cameraMovementMap;

		RenderVisitor* m_RenderVisitor;

		int m_width;
		int m_height;

		int m_fps;

		float m_frustum[6][4];

		void drawHud();

		void ortho();
		void perspective();
		
	public:
		Camera( int width, int height, Game* game );
		~Camera();
		void resize( int width, int height );

		void render( float frametime );
		void drawText( const Position& h, char *string);

		void drawBoundingBox( AbstractEntity* ent );

		void calculateFrustumPoints();
		bool isBoundingBoxInFrustum( Vector vect, Vector size );

		void drawNormals( Entity* ent );

		void setMovementMap( const CameraMovementMap& map );
		const CameraMovementMap& getMovementMap() { return m_cameraMovementMap; }
};




#endif
